<?php

declare(strict_types=1);

namespace app\model\admin;

use app\model\AdminBaseModel;
use think\Model;

/**
 * @mixin \think\Model
 */
class CateModel extends AdminBaseModel
{
    // 数据表名称
    protected $table = 'cate';
    protected $scopeField = true;

    //可搜索字段
    protected $searchField = [];
    // like
    protected $singleSearchField = ['name'];
    //可作为条件的字段
    protected $whereField = ['status'];
    //可做为时间范围查询的字段
    protected $timeField = ['created_at'];
    public function cate()
    {
        return $this->hasMany(CateModel::class, 'pid', 'id');
    }
    // public function getPicAttr($val, $data)
    // {
    //     if ($data['pic']) {
    //         return env('APP_URL')  . $data['pic'];
    //     } else {
    //         return "";
    //     }
    // }
}
